package com.example.ChanOfResponsibility2;

public abstract class AbstractLogger {
    public final static int INFO = 1, DEBUG = 2, ERROR = 3;
    public int level = 0;
    public AbstractLogger nextLogger = null;
    public void setNextLogger(AbstractLogger logger) {
        this.nextLogger=logger;
    }
    public void logMessage(int level, Object msg) {
        if (this.level <= level)
            this.write(msg);
        if (this.nextLogger != null) {
            this.nextLogger.logMessage(level, msg);
        }
    }
    public abstract void write(Object str);
}
